if (!window.$)
    window.$ = window.jQuery;

//Prepends a button to the element with id "collapsable"
//and toggles the visibility of the element with id "collapsee"
//when the button gets clicked
$(document).ready(function() {
    var createActionButton = function() {
	var btn = $(document.createElement("input"));
	btn.attr("type", "button");
	btn.attr("className", "button");
	btn.css("margin-bottom", "15px");
	btn.val("Hide added questions");
	btn.isHide = true;
	btn.toggle = function() {
	    btn.isHide = !btn.isHide;
	    btn.val(btn.isHide?
		"Hide added questions" : "Show added questions");
	};
	
	btn.click(function() {
	    if (btn.isHide) {
		$("#collapsee").slideUp(500);
	    } else {
		$("#collapsee").slideDown(500);		
	    }
	    btn.toggle();
	    });
	
	return btn;
    };
    
    $("#collapsable").prepend(createActionButton()); 
});